package com.baizhi.reflect2;

public class Person {
    public String name;
    public int age;
    private String address;
    char sex;
    protected String stuId;

    public Person() {
        System.out.println("无参构造函数");
    }

    public Person(String name) {
        this.name = name;
        System.out.println("带有String的构造函数");
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
        System.out.println("带有String，int的构造函数");
    }

    public Person(String name, int age, String address) {
        this.name = name;
        this.age = age;
        this.address = address;
        System.out.println("带有String,int，String的构造函数");
    }

    //成员方法
    public void method1(){
        System.out.println("没有返回值也没有参数的方法");
    }

    public void method2(String name){
        System.out.println("没有返回值，带有参数的方法 name="+name);
    }

    public int method3(){
        System.out.println("有返回值，没有参数的方法");
        return 123;
    }

    public String method4(String name){
        System.out.println("有返回值，有参数的方法");
        return "哈哈"+name;
    }

    private void method5(){
        System.out.println("私有方法");
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", address='" + address + '\'' +
                '}';
    }
}
